/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package classesInterface;

import classesBancodeDados.FichaAdmissaoMedica;
import classesJpa.FichaAdmissaoMedicaJpaController;
import classesJpa.exceptions.NonexistentEntityException;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 *
 * @author Luke
 */
public class TelaFichaAdmisMedic3 extends javax.swing.JFrame {

    /**
     * Creates new form AdmisMedic3
     */
    private TelaFichaAdmisMedic3() {
        initComponents();
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    
    public static TelaFichaAdmisMedic3 getInstance(){
        if(uniqueInstance == null){
            System.out.println("Setando");
            uniqueInstance = new TelaFichaAdmisMedic3();
        }
        return uniqueInstance;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        campoDoenca = new javax.swing.JTextArea();
        jLabel4 = new javax.swing.JLabel();
        campoAlergia = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        campoCirurgia = new javax.swing.JTextField();
        checkHTF = new javax.swing.JCheckBox();
        checkHAS = new javax.swing.JCheckBox();
        checkDM = new javax.swing.JCheckBox();
        checkTB = new javax.swing.JCheckBox();
        checkHEP = new javax.swing.JCheckBox();
        checkDislipidemia = new javax.swing.JCheckBox();
        checkBanhoRio = new javax.swing.JCheckBox();
        checkCasaTaipa = new javax.swing.JCheckBox();
        campoCasaTaipa = new javax.swing.JTextField();
        campoTrauma = new javax.swing.JTextField();
        checkTrauma = new javax.swing.JCheckBox();
        checkNeo = new javax.swing.JCheckBox();
        campoNeoAPH = new javax.swing.JTextField();
        checkTabagismo = new javax.swing.JCheckBox();
        campoTabagismo = new javax.swing.JTextField();
        checkAlcoolismo = new javax.swing.JCheckBox();
        campoAlcoolismo = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel6 = new javax.swing.JLabel();
        campoHAS = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        campoDM = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        campoTB = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        campoNeoAF = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        campoDislipidemias = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        campoOutros = new javax.swing.JTextField();
        botaoCancelar = new javax.swing.JButton();
        botaoProximo = new javax.swing.JButton();
        botaoAnterior = new javax.swing.JButton();
        botaoSalvar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Andalus", 1, 14)); // NOI18N
        jLabel1.setText("Antecedentes Pessoais e Hábitos");

        jLabel2.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel2.setText("Doenças Anteriores:");

        campoDoenca.setColumns(20);
        campoDoenca.setRows(5);
        jScrollPane1.setViewportView(campoDoenca);

        jLabel4.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel4.setText("Alergias:");

        jLabel5.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel5.setText("Cirurgias:");

        checkHTF.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkHTF.setText("HTF");
        checkHTF.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkHTFActionPerformed(evt);
            }
        });

        checkHAS.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkHAS.setText("HAS");
        checkHAS.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkHASActionPerformed(evt);
            }
        });

        checkDM.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkDM.setText("DM");
        checkDM.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkDMActionPerformed(evt);
            }
        });

        checkTB.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkTB.setText("TB");
        checkTB.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkTBActionPerformed(evt);
            }
        });

        checkHEP.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkHEP.setText("HEP");
        checkHEP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkHEPActionPerformed(evt);
            }
        });

        checkDislipidemia.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkDislipidemia.setText("Dislipidemia");
        checkDislipidemia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkDislipidemiaActionPerformed(evt);
            }
        });

        checkBanhoRio.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkBanhoRio.setText("Banho de Rio");
        checkBanhoRio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkBanhoRioActionPerformed(evt);
            }
        });

        checkCasaTaipa.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkCasaTaipa.setText("Casa de Taipa");
        checkCasaTaipa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkCasaTaipaActionPerformed(evt);
            }
        });

        checkTrauma.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkTrauma.setText("Trauma");
        checkTrauma.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkTraumaActionPerformed(evt);
            }
        });

        checkNeo.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkNeo.setText("Neo");
        checkNeo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkNeoActionPerformed(evt);
            }
        });

        checkTabagismo.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkTabagismo.setText("Tabagismo");
        checkTabagismo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkTabagismoActionPerformed(evt);
            }
        });

        checkAlcoolismo.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        checkAlcoolismo.setText("Alcoolismo");
        checkAlcoolismo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkAlcoolismoActionPerformed(evt);
            }
        });

        jLabel3.setFont(new java.awt.Font("Andalus", 1, 14)); // NOI18N
        jLabel3.setText("Antecedentes Familiares");

        jLabel6.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel6.setText("HAS");

        jLabel7.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel7.setText("DM");

        jLabel8.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel8.setText("TB");

        jLabel9.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel9.setText("NEO");

        jLabel10.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel10.setText("Dislipidemias:");

        jLabel11.setFont(new java.awt.Font("Calibri Light", 1, 11)); // NOI18N
        jLabel11.setText("Outros:");

        botaoCancelar.setText("Cancelar");
        botaoCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoCancelarActionPerformed(evt);
            }
        });

        botaoProximo.setText("Próximo >");
        botaoProximo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoProximoActionPerformed(evt);
            }
        });

        botaoAnterior.setText("< Anterior");
        botaoAnterior.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoAnteriorActionPerformed(evt);
            }
        });

        botaoSalvar.setText("Salvar");
        botaoSalvar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoSalvarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jSeparator1)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jScrollPane1))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campoAlergia, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel5)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campoCirurgia))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(checkHTF)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkHAS)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkDM)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkTB)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkHEP)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(checkDislipidemia)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkBanhoRio)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkCasaTaipa)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campoCasaTaipa))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(checkTrauma)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campoTrauma, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkNeo)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(campoNeoAPH, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkTabagismo)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(campoTabagismo, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(checkAlcoolismo)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(campoAlcoolismo))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel6)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(campoHAS, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel7)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(campoDM, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel8)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(campoTB, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel9)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(campoNeoAF, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(jLabel10)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(campoDislipidemias, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jLabel11)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(campoOutros, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(botaoSalvar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(botaoAnterior)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botaoCancelar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(botaoProximo))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(campoAlergia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5)
                    .addComponent(campoCirurgia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(checkHTF)
                    .addComponent(checkHAS)
                    .addComponent(checkDM)
                    .addComponent(checkTB)
                    .addComponent(checkHEP)
                    .addComponent(checkDislipidemia)
                    .addComponent(checkBanhoRio)
                    .addComponent(checkCasaTaipa)
                    .addComponent(campoCasaTaipa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(checkTrauma)
                    .addComponent(campoTrauma, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(checkNeo)
                    .addComponent(campoNeoAPH, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(checkTabagismo)
                    .addComponent(campoTabagismo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(checkAlcoolismo)
                    .addComponent(campoAlcoolismo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(campoHAS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel7)
                    .addComponent(campoDM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8)
                    .addComponent(campoTB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9)
                    .addComponent(campoNeoAF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(campoDislipidemias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11)
                    .addComponent(campoOutros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botaoProximo)
                    .addComponent(botaoCancelar)
                    .addComponent(botaoAnterior)
                    .addComponent(botaoSalvar))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void checkHTFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkHTFActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkHTFActionPerformed

    private void checkHASActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkHASActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkHASActionPerformed

    private void checkDMActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkDMActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkDMActionPerformed

    private void checkTBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkTBActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkTBActionPerformed

    private void checkHEPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkHEPActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkHEPActionPerformed

    private void checkDislipidemiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkDislipidemiaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkDislipidemiaActionPerformed

    private void checkBanhoRioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkBanhoRioActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkBanhoRioActionPerformed

    private void checkCasaTaipaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkCasaTaipaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkCasaTaipaActionPerformed

    private void checkTraumaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkTraumaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkTraumaActionPerformed

    private void checkNeoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkNeoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkNeoActionPerformed

    private void checkTabagismoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkTabagismoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkTabagismoActionPerformed

    private void checkAlcoolismoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAlcoolismoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_checkAlcoolismoActionPerformed

    private void botaoCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoCancelarActionPerformed
        TelaFichaAdmisMedic1.getInstance().limpaCampos();
        TelaFichaAdmisMedic2.getInstance().limpaCampos();
        TelaFichaAdmisMedic3.getInstance().limpaCampos();
        TelaFichaAdmisMedic4.getInstance().limpaCampos();
        this.setVisible(false);
    }//GEN-LAST:event_botaoCancelarActionPerformed

    private void botaoProximoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoProximoActionPerformed
        TelaFichaAdmisMedic4.getInstance().setFicha(ficha);
        TelaFichaAdmisMedic4.getInstance().preencheCampos(ficha);
        TelaFichaAdmisMedic4.getInstance().turnEditable(editable);
        this.setVisible(false);
        TelaFichaAdmisMedic4.getInstance().setVisible(true);
    }//GEN-LAST:event_botaoProximoActionPerformed

    private void botaoAnteriorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoAnteriorActionPerformed
        this.setVisible(false);
        TelaFichaAdmisMedic2.getInstance().setVisible(true);
    }//GEN-LAST:event_botaoAnteriorActionPerformed

    private void botaoSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoSalvarActionPerformed
        FichaAdmissaoMedicaJpaController jpa = new FichaAdmissaoMedicaJpaController();
        ficha.getAntecedFamiliares().setDislipidemias(campoDislipidemias.getText());
        ficha.getAntecedFamiliares().setDm(campoDM.getText());
        ficha.getAntecedFamiliares().setHas(campoHAS.getText());
        ficha.getAntecedFamiliares().setNeo(campoNeoAF.getText());
        ficha.getAntecedFamiliares().setOutros(campoOutros.getText());
        ficha.getAntecedFamiliares().setTb(campoTB.getText());
        ficha.getAntecedPessoais().setAlcoolismo(campoAlcoolismo.getText());
        ficha.getAntecedPessoais().setAlergias(campoAlergia.getText());
        ficha.getAntecedPessoais().setBanhoRio(checkBanhoRio.isSelected());
        ficha.getAntecedPessoais().setCasaTaipa(campoCasaTaipa.getText());
        ficha.getAntecedPessoais().setCirurgias(campoCirurgia.getText());
        ficha.getAntecedPessoais().setDislipidemia(checkDislipidemia.isSelected());
        ficha.getAntecedPessoais().setDm(checkDM.isSelected());
        ficha.getAntecedPessoais().setDoencasAnteriores(campoDoenca.getText());
        ficha.getAntecedPessoais().setHas(checkHAS.isSelected());
        ficha.getAntecedPessoais().setHep(checkHEP.isSelected());
        ficha.getAntecedPessoais().setHtf(checkHTF.isSelected());
        ficha.getAntecedPessoais().setNeo(campoNeoAPH.getText());
        ficha.getAntecedPessoais().setTabagismo(campoTabagismo.getText());
        ficha.getAntecedPessoais().setTb(checkTB.isSelected());
        ficha.getAntecedPessoais().setTrauma(campoTrauma.getText());
        try {
            jpa.edit(ficha);
        } catch (NonexistentEntityException ex) {
            JOptionPane.showMessageDialog(null, "Ficha não encontrada.");
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, "Erro na comunicação com o Banco de Dados.");
        }
    }//GEN-LAST:event_botaoSalvarActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        TelaFichaAdmisMedic1.getInstance().limpaCampos();
        TelaFichaAdmisMedic2.getInstance().limpaCampos();
        TelaFichaAdmisMedic3.getInstance().limpaCampos();
        TelaFichaAdmisMedic4.getInstance().limpaCampos();
        setVisible(false);
    }//GEN-LAST:event_formWindowClosing

    public void turnEditable(boolean editable){
        this.editable = editable;
        botaoSalvar.setEnabled(editable);
        campoDoenca.setEditable(editable);
        campoAlergia.setEditable(editable);
        campoCirurgia.setEditable(editable);
        checkHTF.setEnabled(editable);
        checkHAS.setEnabled(editable);
        checkDM.setEnabled(editable);
        checkTB.setEnabled(editable);
        checkHEP.setEnabled(editable);
        checkDislipidemia.setEnabled(editable);
        checkBanhoRio.setEnabled(editable);
        checkCasaTaipa.setEnabled(editable);
        campoCasaTaipa.setEditable(editable);
        checkTrauma.setEnabled(editable);
        campoTrauma.setEditable(editable);
        checkNeo.setEnabled(editable);
        campoNeoAPH.setEditable(editable);
        checkTabagismo.setEnabled(editable);
        campoTabagismo.setEditable(editable);
        checkAlcoolismo.setEnabled(editable);
        campoAlcoolismo.setEditable(editable);
        campoHAS.setEditable(editable);
        campoDM.setEditable(editable);
        campoTB.setEditable(editable);
        campoNeoAF.setEditable(editable);
        campoDislipidemias.setEditable(editable);
        campoOutros.setEditable(editable);
    }
    
    public void limpaCampos(){
        campoAlergia.setText("");
        campoCirurgia.setText("");
        campoDM.setText("");
        campoDislipidemias.setText("");
        campoDoenca.setText("");
        campoHAS.setText("");
        campoNeoAF.setText("");
        campoOutros.setText("");
        campoTB.setText("");
        checkAlcoolismo.setSelected(false);
        checkBanhoRio.setSelected(false);
        checkDM.setSelected(false);
        checkDislipidemia.setSelected(false);
        checkHAS.setSelected(false);
        checkHEP.setSelected(false);
        checkHTF.setSelected(false);
        checkNeo.setSelected(false);
        checkTB.setSelected(false);
        checkTabagismo.setSelected(false);
        checkCasaTaipa.setSelected(false);
        checkTrauma.setSelected(false);
    }
    
    public void preencheCampos(FichaAdmissaoMedica ficha){
        campoAlergia.setText(ficha.getAntecedPessoais().getAlergias());
        campoCirurgia.setText(ficha.getAntecedPessoais().getCirurgias());
        campoDM.setText(ficha.getAntecedFamiliares().getDm());
        campoDislipidemias.setText(ficha.getAntecedFamiliares().getDislipidemias());
        campoDoenca.setText(ficha.getAntecedPessoais().getDoencasAnteriores());
        campoHAS.setText(ficha.getAntecedFamiliares().getHas());
        campoNeoAF.setText(ficha.getAntecedFamiliares().getNeo());
        campoOutros.setText(ficha.getAntecedFamiliares().getOutros());
        campoTB.setText(ficha.getAntecedFamiliares().getTb());
        checkAlcoolismo.setSelected(!ficha.getAntecedPessoais().getAlcoolismo().equals(""));
        checkBanhoRio.setSelected(ficha.getAntecedPessoais().isBanhoRio());
        checkDM.setSelected(ficha.getAntecedPessoais().isDm());
        checkDislipidemia.setSelected(ficha.getAntecedPessoais().isDislipidemia());
        checkHAS.setSelected(ficha.getAntecedPessoais().isHas());
        checkHEP.setSelected(ficha.getAntecedPessoais().isHep());
        checkHTF.setSelected(ficha.getAntecedPessoais().isHtf());
        checkNeo.setSelected(!ficha.getAntecedPessoais().getNeo().equals(""));
        checkTB.setSelected(ficha.getAntecedPessoais().isTb());
        checkTabagismo.setSelected(!ficha.getAntecedPessoais().getTabagismo().equals(""));
        checkCasaTaipa.setSelected(!ficha.getAntecedPessoais().getCasaTaipa().equals(""));
        checkTrauma.setSelected(!ficha.getAntecedPessoais().getTrauma().equals(""));
    }

    public boolean isEditable() {
        return editable;
    }

    public void setEditable(boolean editable) {
        this.editable = editable;
    }

    public FichaAdmissaoMedica getFicha() {
        return ficha;
    }

    public void setFicha(FichaAdmissaoMedica ficha) {
        this.ficha = ficha;
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TelaFichaAdmisMedic3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TelaFichaAdmisMedic3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TelaFichaAdmisMedic3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TelaFichaAdmisMedic3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TelaFichaAdmisMedic3().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton botaoAnterior;
    private javax.swing.JButton botaoCancelar;
    private javax.swing.JButton botaoProximo;
    private javax.swing.JButton botaoSalvar;
    private javax.swing.JTextField campoAlcoolismo;
    private javax.swing.JTextField campoAlergia;
    private javax.swing.JTextField campoCasaTaipa;
    private javax.swing.JTextField campoCirurgia;
    private javax.swing.JTextField campoDM;
    private javax.swing.JTextField campoDislipidemias;
    private javax.swing.JTextArea campoDoenca;
    private javax.swing.JTextField campoHAS;
    private javax.swing.JTextField campoNeoAF;
    private javax.swing.JTextField campoNeoAPH;
    private javax.swing.JTextField campoOutros;
    private javax.swing.JTextField campoTB;
    private javax.swing.JTextField campoTabagismo;
    private javax.swing.JTextField campoTrauma;
    private javax.swing.JCheckBox checkAlcoolismo;
    private javax.swing.JCheckBox checkBanhoRio;
    private javax.swing.JCheckBox checkCasaTaipa;
    private javax.swing.JCheckBox checkDM;
    private javax.swing.JCheckBox checkDislipidemia;
    private javax.swing.JCheckBox checkHAS;
    private javax.swing.JCheckBox checkHEP;
    private javax.swing.JCheckBox checkHTF;
    private javax.swing.JCheckBox checkNeo;
    private javax.swing.JCheckBox checkTB;
    private javax.swing.JCheckBox checkTabagismo;
    private javax.swing.JCheckBox checkTrauma;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    // End of variables declaration//GEN-END:variables
    private static TelaFichaAdmisMedic3 uniqueInstance = null;
    private boolean editable;
    private FichaAdmissaoMedica ficha = null;
}
